<template>
  <a-date-picker v-model:value="value" @change="change" v-bind="$attrs" />
</template>

<script>
import moment from "moment";
import { ref } from "@vue/reactivity";
export default {
  props: {
    currentVal: {
      type: String,
      required: true,
    },
    format: {
      type: String,
      required: true,
    },
  },
  setup(props, { emit }) {

    let value = ref(moment(props.currentVal, props.format));

    const change = (moment, e) => {
      emit("update:currentVal", e);
    };
    return {
      value,
      moment,
      // dateFormat,
      change,
    };
  },
};
</script>

<style>
</style>